From 2a204e46b5d4040b79ce60b0fe796ceb65ba5245 Mon Sep 17 00:00:00 2001 From: robertl Date: Tue, 22 Aug 2006 18:09:49 +0000 Subject: [PATCH] An1: Don't assume URL is present in both old _and_ new formats. --- gpsbabel/an1.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/gpsbabel/an1.c b/gpsbabel/an1.c index cc15fe0fc..53b661138 100644 --- a/gpsbabel/an1.c +++ b/gpsbabel/an1.c @@ -415,11 +415,16 @@ static void Read_AN1_Waypoint( FILE *f, an1_waypoint_record *wpt ) { ofs += 2; if ( len ) { + char *oldurlstr; /* * Trust URL encoded in new format over one in - * old format. Whack the name starting at '{URL='. + * old format if both are present. Whack the + * name starting at '{URL='. */ - wpt->name[strlen(wpt->name) - len - 6] = 0; + oldurlstr = strstr(wpt->name, "{URL="); + if (oldurlstr) { + *oldurlstr = 0; + } wpt->url = xcalloc( len+1, 1 ); memcpy( wpt->url, ofs, len ); -- 2.30.2